/**
 * create by young (young2f@outlook.com) on 2020/11/7
 */

'use strict';
import ComponentBase from './ComponentBase';

export default class TreeBase extends ComponentBase {
  constructor(props) {
    super(props);
    this.props = props;
    this.state = { selectedRowKeys: [] };
  }

  /**
   * 获取树的数据
   * 物料的数据包括产品，所以单独处理
   * @param table
   * @param treeId
   * @param resultKey
   * @returns {Promise<*>}
   */
  async requestTreeData(table, treeId) {
    // let type = table === 'material' ? 'treeNode/getMaterialTreeData' : 'treeNode/getData';
    let type = 'treeNode/getData';
    const res = await this.props.dispatch({
      type,
      payload: { table, treeId },
    });
    return res;
  }
}
